package io.kiki.sba.registry.common.model;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;

public class ServerDataBoxInputStream extends ObjectInputStream {


    public ServerDataBoxInputStream(InputStream inputStream) throws IOException {
        super(inputStream);
    }


    @Override
    protected Class<?> resolveClass(ObjectStreamClass objectStreamClass) throws IOException, ClassNotFoundException {
        String name = objectStreamClass.getName();
        try {
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            return Class.forName(name, false, classLoader);
        } catch (ClassNotFoundException ex) {
            return super.resolveClass(objectStreamClass);
        }
    }
}
